//
//  ViewController.swift
//  JRQRCode
//
//  Created by 京睿 on 2017/4/21.
//  Copyright © 2017年 JingRuiWangKe. All rights reserved.
//

import UIKit
import AVFoundation

class ViewController: UIViewController, JRQRCodeManagerDelegate {
    
    var maneger: JRQRCodeManager!
    
    
    var captureSession: AVCaptureSession!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        maneger = JRQRCodeManager.manger(for: view, boxFrame: CGRect.init(x: 0, y: 0, width: 200, height: 200))
        maneger.JRDelegate = self
    }
    
    @IBAction func a(_ sender: Any) {
        if maneger.isRunning {
            maneger.stopScan()
        } else {
            maneger.startScan()
        }
    }
    
    func JRQRCodeManger(_ manager: JRQRCodeManager, update metadataObjects: [JRQRCodeModel]!) {
        print(metadataObjects)
    }
    
    func JRQRCodeManger(_ manager: JRQRCodeManager, initializeFailed: Error!) {
        print("123")
    }
}

